{% extends 'base.html' %}

{% block title %} 修改用户 {% endblock %}

{% block article %}
    <!-- 表单内容 -->
    <div class="col-sm-offset-3 col-sm-6">
        {# 1.修改action与method   #}
        <form class="form-horizontal" role="form" action="{% url 'alter' user.id %}" method="post">
            {# 2.加入csrf_token，执行Post请求           #}
            {% csrf_token %}
            <div class="form-group">
                <label for="username" class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="username" placeholder="请输入用户名" name="username" value="{{ user.username }}">
                </div>
            </div>
            <div class="form-group">
                <label for="password" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="password" placeholder="请输入密码" name="password" value="{{ user.password }}">
                </div>
            </div>
            <div class="form-group">
                <label for="age" class="col-sm-2 control-label">年龄</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="age" placeholder="请输入年龄" name="age" value="{{ user.age }}">
                </div>
            </div>
            <div class="form-group">
                <label for="email" class="col-sm-2 control-label">邮箱</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="email" placeholder="请输入邮箱" name="email" value="{{ user.email }}">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">修改</button>
                </div>
            </div>
        </form>
    </div>
{% endblock %}

